function fig = main_screen()
% Generate the Datac main screen and controls
% PBManis 9-10/98, 11/98
% 

% We attempt to make a system independent display by
% using character spacing... this should allow the display to be correctly
% sized on windows, mac and unix systems, although the view may not be
% as pretty all the time
%
b_ht = 1.7;
pad_check = 7; pad_edit = 5; pad_list = 5; pad_pop = 7;
pad_push = 4; pad_radio = 7; pad_static = 4;
but_vpad = 0.125;
but_hpad = 1;

but_vspc = b_ht + but_vpad; % space to allocate for each button or field

% build the button list (only 1 column of buttons in this version)
buttonlist = [];
buttonlist = add_button(buttonlist, 'Open', 'datac open;', 'Open a file', 'Open', 'on');
buttonlist = add_button(buttonlist, 'Auto Entry', 'datac auto_set;', 'Add current data to control auto', 'Auto_set', 'on');
% buttonlist = add_button(buttonlist, 'Parse Note', 'datac ParseNote;', 'Parse/abstract the notefile', 'ParseNote', 'on');
% buttonlist = add_button(buttonlist, 'Scan', 'datac scan;', 'Scan open file', 'Scan', 'off');
% buttonlist = add_button(buttonlist, 'View Note', 'datac Notefile;', 'View a notefile in editor', 'Control', 'on');
buttonlist = add_button(buttonlist, 'Add Entry', 'datac ToControl;', 'Add current data to control sheet', 'ToControl', 'on');
% buttonlist = add_button(buttonlist, 'Add Protocol', 'datac ToControl2;', 'Add all protocols of a kind to control sheet', 'ToControl2', 'on');
% buttonlist = add_button(buttonlist, 'Delete Entry', 'datac DeleteControl;', 'Delete current control selection', 'DeleteControl', 'on');
buttonlist = add_button(buttonlist, 'Edit Entry', 'edit_control edit;', 'Edit current control selection', 'EditControl', 'on');
buttonlist = add_button(buttonlist, 'Param Edit', 'param_edit', 'Edit control parameters on selection', 'ParamEditButton', 'on');
buttonlist = add_button(buttonlist, 'Selector', 'proto_select', 'Select table Entries', 'ProtocolSelectButton', 'on');

buttonlist = add_button(buttonlist, 'Tag Entry', 'datac Tag;', 'Tag Selected entry', 'Tag', 'on');
buttonlist = add_button(buttonlist, 'UnTag Entry', 'datac unTag;', 'UnTag Selected entry', 'Tag', 'on');
% buttonlist = add_button(buttonlist, 'Combine Entries', 'datac Combine;', 'Combine Selected entries', 'Combine', 'on');
buttonlist = add_button(buttonlist, 'Data/List', 'datac Toggle;', 'Toggle view', 'ToggleButton', 'on');
%buttonlist = add_button(buttonlist, 'Path', 'datac SetPath;', 'Toggle Path','SetPath', 'on');
buttonlist = add_button(buttonlist, 'hrule');
buttonlist = add_button(buttonlist, 'Zoom', 'datac zoom;', 'Zoom data', 'ZoomButton', 'on');
buttonlist = add_button(buttonlist, 'unZoom', 'datac unzoom;', 'UnZoom data', 'UnZoomButton', 'on');
buttonlist = add_button(buttonlist, 'Average', 'datac average;', 'Average data', 'AverageButton', 'on');
buttonlist = add_button(buttonlist, 'Raw Traces', 'datac rawtraces;', 'Show Raw Traces', 'RawTraceButton', 'on');

buttonlist = add_button(buttonlist, 'Exit', 'datac EXIT;', 'Exit and save status', 'Exit', 'on', 1);


maxtitle = 0;
for i=1:length(buttonlist)
   l = length(buttonlist(i).title);
   if(l > maxtitle) maxtitle = l;
   end
end
but_width = maxtitle+2*but_hpad;

scrsz = get(0,'ScreenSize'); % determine the position of the figure in the system window
size=1.0;
scrb = 30; % scrsz(4)*((1-size)/2);
scrl = 30; % scrsz(3)*((1-size)/2);
scrwd = 1000; % scrsz(3) - 5; % *size;
scrht = 700; %scrsz(4) - 40; %*size;

h0 = figure('name', 'Datac Analysis', ...
   'BackingStore', 'on', ...
   'NumberTitle', 'off', ...
   'Color', [0.75 0.75 0.75], ...
   'Colormap',[1,1,1], ...
   'Position', [scrl, scrb, scrwd, scrht], ...
   'MenuBar', 'none', ...
   'WindowButtonMotionFcn', 'datac(''mouse_motion'', gcbf);', ...
   'WindowButtonDownFcn', 'datac(''mouse_down'', gcbf);', ...
   'WindowButtonUpFcn', 'datac(''mouse_up'', gcbf);', ...
   'Tag','datac_main');
set(h0, 'Units', 'characters');
figsz=get(h0, 'Position');
% set(gcf, 'Renderer', 'painters');
set(gcf, 'Renderer', 'OpenGL');

button_x = figsz(3) - but_width-but_hpad;  % place the buttons to the right side of the display
button_y = figsz(4)*0.75-1;

infobox_x=1;
infobox_y=figsz(4);
info_width = 90; % width in characters
info_border = 0.25;

backcolor=[0.0 0.0 0.0];
f_ht=(b_ht+but_vpad)*6;
frame_right=info_width+infobox_x*2*info_border;

listbox_x=1;
listbox_y = figsz(4)*0.75;

abstract_width = figsz(3) - frame_right - 2;

top=figsz(4);
topb = figsz*0.75;

% first set up the "information area" - Que message, drive and default extension
% gain selection, and record number areas
% Make a background frame for the information area


h1 = uicontrol('Parent',h0, ...
   'Units','characters', ...
   'BackgroundColor',backcolor, ...
   'ForegroundColor', 'black', ...
   'ListboxTop',0, ...
   'Position',[infobox_x-info_border top-f_ht-info_border frame_right+info_border*2 f_ht+info_border*2], ...
   'HorizontalAlignment','left', ...
   'Style','frame', ...
   'Tag','Fileframe');

% Set up the Que Message text box (make it a list box so that it scrolls)
h1 = uicontrol('Parent',h0, ...
   'Units','characters', ...
   'BackgroundColor','white', ...
   'ForegroundColor', 'black', ...
   'ListboxTop',1, ...
   'Position',[infobox_x infobox_y-3*but_vspc info_width 3*b_ht], ...
   'HorizontalAlignment','left', ...
   'String','(waiting for command)', ...
   'TooltipString', 'Que Message', ...
   'Style','ListBox', ...
   'FontSize', 10, ...
   'Tag','QueMessage');

% Drive selection
h1 = popupmenu('Drive', 'Drive', 'datac setdrive', 'A:|B:|C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:', ...
   2, infobox_x, infobox_y-4*but_vspc);

% checkbox for directory override flag
hck = uicontrol('Units', 'characters', ...
   'foregroundcolor', 'white', ...
   'backgroundcolor', [0 0 0], ...
   'position', [infobox_x+info_width*0.77 infobox_y-5*but_vspc 18 1.6], ...
   'horizontalalignment', 'right', ...
   'fontsize', 10, ...
   'style', 'checkbox', ...
   'String', 'Force Drive', ...
   'tag', 'driveflag_chkbx');

% Current Path Listing
h1 = textentry('Path', 'Path ', ' ', 62, infobox_x+info_width/4, infobox_y-4*but_vspc, 'datac(''pickpath'', ''Path'')');
set(h1, 'horizontalalignment', 'left');

% vgain text box
h1 = textentry('Vgain', 'Vgain', '     10', 15, infobox_x, infobox_y-5*but_vspc);

% igain text box
h1 = textentry('Igain', 'Igain', '      1', 15, infobox_x, infobox_y-6*but_vspc);


% Extension Selection
h1 = popupmenu('FileExtension', 'Ext  ', 'datac setextension', ...
   '*.mat|*.abf|*.pbm|*.PBM|*.pok|*.jlf|*.scm|*.hwf|*.jsr|*.dpp|*.aeb|*.jaw|*.olf|*.som|*.gas|*.alo|*.ave|*.dat', ...
   6, infobox_x+info_width*(3/4), infobox_y-6*but_vspc);

% Data mode Selection
h1 = popupmenu('FileMode', 'Mode ', '', 'CC|VC|FP', ...
   6, infobox_x + info_width/4, infobox_y-6*but_vspc);

% I units selection
h1 = popupmenu('IUnits', 'Units', 'datac setunits', ...
   'uA|nA|pA', 6, infobox_x+info_width/2, infobox_y-6*but_vspc);

%Record list text box
h1 = textentry('RecList', 'Recs ', '1;21', 24, infobox_x+info_width/4, infobox_y-5*but_vspc);
set(h1, 'horizontalalignment', 'left');

% checkbox for plot flag (auto for analysis).
hck = uicontrol('Units', 'characters', ...
   'foregroundcolor', 'white', ...
   'backgroundcolor', [0 0 0], ...
   'position', [infobox_x+info_width*(0.65) infobox_y-5*but_vspc 9 1.6], ...
   'horizontalalignment', 'right', ...
   'fontsize', 10, ...
   'style', 'checkbox', ...
   'String', 'Plot', ...
   'tag', 'plotflag_chkbx');

%------------
% frame for graphics etc.
%------------
framecolor=[0.7 0.7 0.7]; % a kind of grey
frame_left=2;
frame_width=figsz(3)-4-but_width-but_hpad;
frame_bottom=1;
frame_height=figsz(4)-f_ht-2;
h1 = uicontrol('Parent',h0, ...
   'Units','characters', ...
   'BackgroundColor',framecolor, ...
   'ForegroundColor', 'black', ...
   'ListboxTop',0, ...
   'Position',[frame_left frame_bottom frame_width frame_height], ...
   'HorizontalAlignment','left', ...
   'Style','frame', ...
   'Tag','DataFrame');

%--------------
% command buttons are here

cmd_vspc = but_vspc + 2*but_vpad; % extra padding
for i=1:length(buttonlist)
   b_y = button_y-i*cmd_vspc;
   if(~isempty(buttonlist(i).pos))
      b_y = 1;
   end
   h1=uicontrol('Parent', h0, ...
      'Units', 'characters', ...
      'FontUnits', 'points', ...
      'FontName', 'Arial', ...
      'FontSize', 9, ...
      'ForegroundColor', 'blue', ...
      'Position', [button_x b_y but_width+0.5 b_ht], ...
      'String', buttonlist(i).title, ...
      'ToolTipString', buttonlist(i).tooltip, ...
      'Callback', buttonlist(i).callback, ...
      'Tag', buttonlist(i).tag);
end


%-------------------------------------------
% List box with the Control table access
% the listbox exists inside the main frame and is swapped with the graphics as necessary.
% 
%-------------------------------------------
% List box with the Control table access
% the listbox exists inside the main frame and is swapped with the graphics as necessary.
% 
h1 = uicontrol('Parent',h0, ...
   'Units','characters', ...
   'ListboxTop',1, ...
   'FontUnits', 'points', ...
   'FontName', 'Lucida Console', ...
   'FontSize', 8, ...
   'BackgroundColor',[0 0 0], ...
   'ForegroundColor', [1.0 0.8 0.1]', ...
   'Position',[frame_left+0.5 frame_bottom+0.5 frame_width-1 frame_height-1], ...
   'String','<empty>', ...
   'Style', 'Listbox', ...
   'TooltipString', 'Select a dataset for analysis', ...
   'Callback', 'datac List_Dispatch;', ...
   'Tag','CTL');

%-------------------------------------------
% List box for abstract of note file
%

h1 = uicontrol('Parent',h0, ...
   'Units','characters', ...
   'BackgroundColor','white', ...
   'ForegroundColor', 'black', ...
   'ListboxTop',1, ...
   'FontUnits', 'points', ...
   'FontName', 'Arial', ...
   'FontSize', 8, ...
   'Position',[infobox_x+info_width+1 top - f_ht abstract_width f_ht], ...
   'HorizontalAlignment','left', ...
   'String','NoteFile', ...
   'Callback', 'datac display2;', ...
   'TooltipString', 'NoteFile Contents (non-editable)', ...
   'Style','Listbox', ...
   'Tag','NoteFile');


%_________________________________________________________
%
% now build the Experiment menu entries.....
%
f = uimenu('Label', '&File', 'Position', 1);
uimenu(f, 'Label', '&Open', 'Callback', 'datac open;');
uimenu(f, 'Label', 'E&xport', 'Callback', 'datac_export;');
uimenu(f, 'Label', '&Display', 'Callback', 'datac display;');
uimenu(f, 'Label', '&Exit', 'Callback', 'datac EXIT;', 'Separator', 'On');

% Data base manipulation menu
f = uimenu('Label','&Database', 'Position', 2);
uimenu(f,'Label','&New','Callback','datac newctl;' );
uimenu(f,'Label','&Open','Callback','datac readmatctl;' );
uimenu(f,'Label','&Save','Callback','datac savematctl;');
uimenu(f,'Label','Save&As','Callback','datac saveasmatctl;');

uimenu(f, 'Label', '&Import', 'Callback', 'datac importctl;', 'Separator', 'On');
uimenu(f, 'Label', 'Import S&ummary', 'Callback', 'datac import_from_summary;', ...
   'Separator', 'Off');

uimenu(f, 'Label', 'E&xtract Selected Entries', 'Callback', 'datac DB_Extract;', 'Separator', 'Off');

uimenu(f,'Label','S&ort by Date', 'Callback', 'datac sortcontrol;', ...
   'Separator', 'On');
uimenu(f,'Label','S&ort by Pid/div', 'Callback', 'datac sortbypnd;', ...
   'Separator', 'Off');
uimenu(f,'Label','So$rt by Experiment', 'Callback', 'datac sortbyExpt;', ...
   'Separator', 'Off');
uimenu(f, 'Label', 'Recompute Sequence #''s', 'Callback', 'resequence;', ...
    'Separator', 'Off');
uimenu(f, 'Label', '&Tag Entry', 'callback', 'datac Tag;');
uimenu(f, 'Label', '&Untag Entry', 'Callback', 'datac UnTag;');

uimenu(f,'Label','Current: none','Callback','', ...
   'Separator', 'On', 'Tag', 'CtlFile');
uimenu(f, 'Label', 'Recent 1: ', 'Callback', 'datac readctl(1);', 'Tag', 'Recent1');
uimenu(f, 'Label', 'Recent 2: ', 'Callback', 'datac readctl(2);', 'Tag', 'Recent2');
uimenu(f, 'Label', 'Recent 3: ', 'Callback', 'datac readctl(3);', 'Tag', 'Recent3');
uimenu(f, 'Label', 'Recent 4: ', 'Callback', 'datac readctl(4);', 'Tag', 'Recent4');


% DB Edit menu
f = uimenu('Label','&Edit', 'Position', 3);

uimenu(f, 'Label', '&Edit', 'Callback', 'edit_control edit;');
uimenu(f, 'Label', 'Select &All', 'Callback', 'datac selectall;', 'Separator', 'Off');
uimenu(f, 'Label', '&Unselect', 'Callback', 'datac unselect;', 'Separator', 'Off');
uimenu(f, 'Label', '&Add Entry', 'Callback', 'datac ToControl;', 'Separator', 'On');
uimenu(f, 'Label', '&Delete Selected Entries', 'Callback', 'datac DeleteControl;', 'Separator', 'Off');
uimenu(f, 'Label', '&Combine Entries', 'Callback', 'datac Combine;');
uimenu(f, 'Label', '&Duplicate Entry', 'Callback', 'datac Duplicate;', 'Separator', 'Off');
uimenu(f,'Label','&Remove Duplicates', 'Callback', 'datac dupe;', ...
   'Separator', 'Off');
uimenu(f, 'Label', 'Add &Protocol', 'Callback', 'datac AddProtocol;', 'Separator', 'On');
uimenu(f, 'Label', '&Find and update Paths (unix)', 'Callback', 'datac unixupdatepaths;');
uimenu(f, 'Label', '&Set New Path', 'Callback', 'datac SetPath;');
uimenu(f,'Label','&Update Paths', 'Callback', 'datac updatepaths', ...
   'Separator', 'Off');


% Analysis menu
f = uimenu('Label','&Analysis', 'Position', 4);
uimenu(f,'Label','&Voltage Clamp IVs','Callback','datac vc_iv;' );
uimenu(f,'Label','&Single Channel','Callback','datac sc;' );
uimenu(f,'Label','&CC IV, Hyp', 'Callback', 'datac cc_iv 1;', ...
   'Separator', 'Off');
uimenu(f,'Label','CC IV, Hyp+s&pike', 'Callback', 'datac cc_iv 2;', ...
   'Separator', 'Off');

uimenu(f,'Label','&EPSC miniAnalysis', 'Callback', 'datac epsc_analysis;', ...
   'Separator', 'On');
uimenu(f,'Label','EPSC Co&v Analysis', 'Callback', 'datac epsc_covariance;', ...
   'Separator', 'Off');
uimenu(f,'Label','EPSC &Rectification', 'Callback', 'datac epsc_rect;', ...
   'Separator', 'Off');

uimenu(f,'Label','EPSC-&IO', 'Callback', 'datac epsc_io;', ...
   'Separator', 'Off');
uimenu(f,'Label','EPSP-&TC', 'Callback', 'datac epsp_tc;', ...
   'Separator', 'Off');
uimenu(f, 'Label', 'Auto-LTP', 'Callback', 'LTP_Auto;', ...
   'Separator', 'Off');

uimenu(f,'Label','&INT-TC', 'Callback', 'datac int_tc;', ...
   'Separator', 'On');
uimenu(f,'Label','VC-TC', 'Callback', 'datac vc_tc;', ...
   'Separator', 'Off');
uimenu(f,'Label','&FP-TC', 'Callback', 'datac fp_tc;', ...
   'Separator', 'Off');
uimenu(f,'Label','&FP-IO', 'Callback', 'datac fp_io;', ...
   'Separator', 'Off');
uimenu(f, 'Label', 'Artifcat Supp: V', 'Callback', 'datac artsuppv;', ...
    'Separator', 'Off');
uimenu(f, 'Label', 'Artifcat Supp: I', 'Callback', 'datac artsuppi;', ...
    'Separator', 'Off');
uimenu(f,'Label','Spike-&Trig Avg', 'Callback', 'datac sta_avg;', ...
   'Separator', 'On');
uimenu(f,'Label', '&Power Spectrum', 'Callback', 'datac pspec;', ...
   'Separator', 'Off');
uimenu(f,'Label','Fo&rward', 'Callback', 'datac fwd;', ...
   'Separator', 'Off');

% Fitting routines for exponential decays...
f2 = uimenu('Label','F&itting', 'Position', 5);
uimenu(f2, 'Label', 'SingleExp fit', 'Callback', 'cursor_fits(''singleexp'');');
uimenu(f2, 'Label', 'DoubleExp fit', 'Callback', 'cursor_fits(''doubleexp'');');
uimenu(f2, 'Label', 'SingleEPSC fit, n=1', 'Callback', 'cursor_fits(''singleepsc'', 1);');
uimenu(f2, 'Label', 'DoubleEPSC fit, n=1', 'Callback', 'cursor_fits(''doubleepsc'', 1);');
uimenu(f2, 'Label', 'SingleEPSC fit, n=2', 'Callback', 'cursor_fits(''singleepsc'', 2);');
uimenu(f2, 'Label', 'DoubleEPSC fit, n=2', 'Callback', 'cursor_fits(''doubleepsc'', 2);');
uimenu(f2, 'Label', 'SingleEPSC fit, n=3', 'Callback', 'cursor_fits(''singleepsc'', 3);');
uimenu(f2, 'Label', 'DoubleEPSC fit, n=3', 'Callback', 'cursor_fits(''doubleepsc'', 3);');
uimenu(f2, 'Label', 'SingleEPSC fit, n=4', 'Callback', 'cursor_fits(''singleepsc'', 4);');
uimenu(f2, 'Label', 'DoubleEPSC fit, n=4', 'Callback', 'cursor_fits(''doubleepsc'', 4);');


% comparisons of analyzed data
f3 = uimenu('Label', '&Comparisons', 'Position', 6);
uimenu(f3, 'Label', 'Compare: Clear plot', 'Callback', 'compare_plot(''clear'');');
uimenu(f3, 'Label', 'Compare: Plot result', 'Callback', 'compare_plot(''plot_result'');');
uimenu(f3, 'Label', 'Compare: &IVs', 'Callback', 'compare_plot(''iv'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: &CCIVs', 'Callback', 'compare_plot(''cciv'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: AverageIV', 'Callback', 'compare_plot(''averageiv'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: CCIVSUmmary', 'Callback', 'compare_plot(''CCIVSummary'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: &HYPs', 'Callback', 'compare_plot(''hyp'');', 'Separator', 'On');
uimenu(f3, 'Label', 'Compare: &FI', 'Callback', 'compare_plot(''fi'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: AverageFI', 'Callback', 'compare_plot(''averagespikecount'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: &Activation', 'Callback', 'compare_plot(''act'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: I&nactivation', 'Callback', 'compare_plot(''inact'');', 'Separator', 'Off');

uimenu(f3, 'Label', 'Compare: &Spikes', 'Callback', 'compare_plot(''spike'');', 'Separator', 'On');
uimenu(f3, 'Label', 'Compare: Pre-spike &current', 'Callback', 'compare_plot(''ispike'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: Pre-spike s&pectrum', 'Callback', 'compare_plot(''spect'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: SACs', 'Callback', 'compare_plot(''SAC'');', 'Separator', 'off');

uimenu(f3, 'Label', 'Compare: &TC_INTs', 'Callback', 'compare_plot(''tc_int'');', 'Separator', 'On');
uimenu(f3, 'Label', 'Compare: &Average TC_INTs', 'Callback', 'compare_plot(''tc_int_avg'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: F&P_TCs', 'Callback', 'compare_plot(''FP_TC'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: A&verage FP_TCs', 'Callback', 'compare_plot(''FP_TC_avg'');', 'Separator', 'Off');
uimenu(f3, 'Label', 'Compare: FP_I&Os', 'Callback', 'compare_plot(''FP_IO'');', 'Separator', 'Off');

uimenu(f3, 'Label', 'Combine: EPSP_TC (Peak V)', 'Callback', 'compare_plot(''EPSP_TC'', 0);', 'Separator', 'On');
uimenu(f3, 'Label', 'Combine: EPSP_TC (Slope)', 'Callback', 'compare_plot(''EPSP_TC'', 1);', 'Separator', 'On');
uimenu(f3, 'label', 'Combine: EPSC_Dep (nA)', 'Callback', 'compare_plot(''ESPC_Dep'', 0);', 'Separator', 'off');

% plugins('create', h0);

% build menu for specialized analyses
f4 = uimenu('Label', 'Plugins', 'Position', 7, 'Callback', 'plugins(''update'')' , 'Accelerator', 'u');
%uimenu(f4, 'Label', 'Update List', 'Callback', 'plugins(''update'')');
%uimenu(f4, 'Label', 'Create List', 'Callback', 'plugins(''create'')');
%uimenu(f4, 'Label', '&HWF VCN CCIV Analysis', 'Callback', 'hwf_CCIV_analysis');
%uimenu(f4, 'Label', 'HWF &Summaries', 'Callback', 'hwf_CCIV_summary');
%uimenu(f4, 'Label', 'JLF &Activation 93', 'Callback', 'jlf_93analysis(1)','Separator', 'On');
%uimenu(f4, 'Label', 'JLF I&nactivation 93', 'Callback', 'jlf_93analysis(2)');
%uimenu(f4, 'Label', 'JLF &Taus 93', 'Callback', 'jlf_93analysis(3)');

% Utility functions.
f5 = uimenu('Label', '&Utilities', 'Position', 8, 'Accelerator', 'U');
uimenu(f5, 'Label', 'Protocol Logic Selector', 'Callback', 'proto_select;', 'Accelerator', 'l');
uimenu(f5, 'Label', 'Parameter Editor', 'Callback', 'param_edit;', 'Accelerator', 'e');
uimenu(f5, 'Label', 'Export Analysis', 'Callback', 'export_analysis;', 'Accelerator', 'x');
uimenu(f5, 'Label', 'Set VC Params', 'Callback', 'datac VCset;');
uimenu(f5, 'Label', 'Set CC Params', 'Callback', 'datac CCset;');
uimenu(f5, 'Label', '&Trace View', 'Callback', 'datac Trace_View;');

uimenu(f5, 'Label', '&Compare Phys. and Imaging', 'Callback', 'imgcmp;'); % just bring up the window.
uimenu(f5, 'Label', 'Convert &Neuron Results', 'Callback', 'datac ImportNeuron;', 'Separator', 'On');
uimenu(f5, 'Label', 'Convert &RTXI Results', 'Callback', 'datac ImportRTXI;');

% View options (mostly for note files...)
f5 = uimenu('Label', '&View', 'Position', 9);
uimenu(f5, 'Label', '&Parse Note', 'Callback', 'datac ParseNote;');
uimenu(f5, 'Label', '&View Selected Note', 'Callback', 'datac ViewNote;', 'Accelerator', 'n');
uimenu(f5, 'Label', 'View &Note in File', 'Callback', 'datac NoteInFile;');
uimenu(f5, 'Label', '&File Info', 'Callback', 'datac FileInfo;');
uimenu(f5, 'Label', '&Refresh List', 'Callback', 'datac Refresh;');
f7 = uimenu('Label', '&Windows', 'Position', 10);

f8 = uimenu('Label', '&Help', 'Position', 11);
uimenu(f8, 'Label', '&Datac Help', 'Callback', 'datac Help;');
uimenu(f8, 'Label', '&About Datac', 'Callback', 'AboutDatac;');

if nargout > 0, fig = h0; end
